//============================================================================
// Name        : CourseRegistration.cpp
// Author      : Sartios
// Version     :
// Copyright   : Savramis Sartios
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
#include <map>
using namespace std;
#include "Controllers/CourseRegistration/CourseRegistrationCreator.h"
#include "Domain/CourseRegistration/CourseList/CourseList.h"
#include "Domain/CourseRegistration/RegistrationDate/RegistrationDate.h"
int main() {

	string 	*	aem = new string;
	string 	*	courseCode = new string;
	string 	*	teacherCode = new string;
	string	*	day = new string;
	string	*	month = new string;
	string	*	year = new string;
	map<string *,string *> *myCourses=new map<string *,string *>;

	map<string *,string *>::iterator start/*=new map<string *,string *>::iterator*/;
	map<string *,string *>::iterator end/*=new map<string *,string *>::iterator*/;



	ICourseRegistration *registration=0;
	ICourseRegistrationCreator *creator = new CourseRegistrationCreator;


	cout<<"\nDay : ";
	cin>>*day;
	cout<<"\nMonth : ";
	cin>>*month;
	cout<<"\nYear : ";
	cin>>*year;

	cout<<"\nEnter A.E.M. : ";
	cin>>*aem;

	for(int i=0;i<3;i++){
		cout<<"\nEnter course code : ";
		cin>>*courseCode;
		cout<<"\nEnter teacher code : ";
		cin>>*teacherCode;

		myCourses->insert(pair<string *,string *>(new string(*courseCode),new string(*teacherCode)));
	}

	registration = creator->getCourseRegistration(aem);
	cout<<*registration->getOwner()<<endl;

	registration =((CourseRegistrationCreator *)creator)->addCourseList(registration,myCourses);

	start = ((CourseList *)registration)->getCourseListStart();
	end = ((CourseList *)registration)->getCourseListEnd();

	for(start;start!=end;start++){
		cout<<*start->first<<"=>"<<*start->second<<endl;
	}

	/*for(*start=myCourses->begin();*start!=myCourses->end();*start++){
		cout<<*((*start)->first)<<"=>"<<*((*start)->second)<<endl;
	}*/

	registration = ((CourseRegistrationCreator *)creator)->addDate((ICourseRegistration *)registration,day,month,year);
	cout<<*((RegistrationDate *)registration)->getDate()<<endl;

	delete aem;
	delete courseCode;
	delete teacherCode;
	delete myCourses;
	delete day;
	delete month;
	delete year;
	delete registration;
	delete creator;
	delete myCourses;

}
